<?php
namespace app\common\controller;
use think\facade\View;
use think\facade\Cache;
use think\facade\Db;
use app\common\variable\MsgCode;
use app\common\model\UserScore as UserScoreModel;
/**
 * 
 */
class UserScore extends Base
{
    public static function getList($D=[])
    {
        $where=[];
        $where[]=['uid','=',$D['uid']];
        if (isset($D['is_get'])) {
            if ($D['is_get']) {
                $where[]=['score','>',0];
            }else{
                $where[]=['score','<',0];
            }
        }
        $Data=UserScoreModel::where($where)
            ->order('id desc')->paginate(15)->each(function($v){
                $v->friendly_time=friendly_time($v->create_time,'friendly');
                return $v;
            });
        if ($Data->items()) {
            return parent::ajaxReturn('',MsgCode::$success,$Data);
        }else{
            return parent::ajaxReturn('暂无数据~',MsgCode::$error);
        }
    }
}